<div class="app-form">
	<form {if $ac} action="{php echo web_url('halfcard/halftype/editmember')}" {else} action="{php echo web_url('halfcard/halfcard_web/editmember')}" {/if} method="post"  class="form-horizontal form-validate">
	<div class="modal-dialog" style="z-index: 50;">
		<div class="modal-content">
			<div class="modal-header">
				<button data-dismiss="modal" class="close" type="button">×</button>
				<h4 class="modal-title">{if $id > 0}编辑{else}新建{/if}会员</h4>
			</div>
			<div class="modal-body" style="margin-left: 100px;">
				<div class="form-group">
					<label class="col-sm-2 control-label"><span style='color:red'>*</span>选择用户</label>
					<div class="col-sm-7">
						{php echo tpl_select_user('memberid', $halfmember['mid']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">过期时间</label>
					<div class="col-md-7">
						{php echo tpl_form_field_date('expiretime',date('Y-m-d H:i:s',$halfmember['expiretime']),true);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">会员等级</label>
					<div class="col-md-7">
						<select name="levelid" style="width: 100%;">
							<option value="0" {if $halfmember['levelid'] == 0 || empty($halfmember['levelid'])} selected="selected" {/if} >{$delevel['name']}</option>
							{loop $levels $level}
							<option value="{$level['id']}" {if $halfmember['levelid'] == $level['id']} selected="selected" {/if} >{$level['name']}</option>
							{/loop}
						</select>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">会员状态</label>
					<div class="col-sm-9">
						<label class="radio-inline">
							<input type="radio" value="0" name="disable" {if $halfmember['disable'] == 0 || empty($halfmember['disable'])} checked="checked" {/if} > 启用
						</label>
						<label class="radio-inline">
							<input type="radio" value="1" name="disable" {if $halfmember['disable'] == 1 } checked="checked" {/if} > 禁用
						</label>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<input type="hidden" name="id" id="id" value="{$halfmember['id']}" />
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="submit" class="btn btn-primary">提交更改</button>
			</div>
		</div>
	</div>
	</form>
</div>
<script>
	$(document).on('show.bs.modal', '.modal', function(event) {
		$(this).appendTo($('body'));
	}).on('shown.bs.modal', '.modal.in', function(event) {
		setModalsAndBackdropsOrder();
	}).on('hidden.bs.modal', '.modal', function(event) {
		setModalsAndBackdropsOrder();
	});


	function setModalsAndBackdropsOrder() {
		var modalZIndex = 1040;
		$('.modal.in').each(function(index) {
			var $modal = $(this);
			modalZIndex++;
			$modal.css('zIndex', modalZIndex);
			$modal.next('.modal-backdrop.in').addClass('hidden').css('zIndex', modalZIndex - 1);
		});
		$('.modal.in:visible:last').focus().next('.modal-backdrop.in').removeClass('hidden');
	}
</script>
